// 主进程通信
const { ipcMain } = require('electron')
const { getConfig } = require('../lib/config')
const start = require('../lib/core')
const login = require('../lib/login')


// 注册
module.exports = function () {
  ipcMain.on('getUserInfo', (event, arg) => {
    event.returnValue = getConfig()
  })
  ipcMain.on('start', (event, arg) => {
    start(arg)
  })
  ipcMain.on('login', async (event, arg) => {
    await login(arg)
    event.sender.send('userInfoData', getConfig())
  })
}

